﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Sockets;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace TestConsoleApp
{
    public class TestTcpClient
    {
        public static void Test()
        {
            for (int i = 0; i < 10; i++)
            {
                TcpClient tcpClient = new TcpClient();

                while (!tcpClient.Connected)
                {
                    tcpClient.Connect("127.0.0.1", 40000);
                    Thread.Sleep(100);
                }



                //Task.Run((Action)delegate
                //{
                //    while (true)
                //    {
                Console.WriteLine("Hello qx!" + i);
                byte[] buffer = Encoding.UTF8.GetBytes("Hello qx!" + i);
                tcpClient.Client.Send(buffer);

                Thread.Sleep(100);
                //    }
                //});
            }
        }
    }
}
